package com.baidu.xiaosu.controller;

import com.baidu.xiaosu.bean.User;
import com.baidu.xiaosu.service.Demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user2")
public class Demo2Controller {

    /*@Autowired
    private RestTemplate restTemplate;
    @Autowired
    private LoadBalancerClient loadBalancerClient;*/
    @Autowired
    private Demo demo;

    @RequestMapping("/hh2/{id}")
    public User getById(@PathVariable("id") String id){
        User byId = demo.getById(id);
        return byId;
    }


    /*@RequestMapping("/getById/{id}")
    public User getById(@PathVariable("id") String id){

        User forObject = restTemplate.getForObject("http://provider:8080/user/getById/"+id, User.class);

        return forObject;
    }*/

}
